export default class LStorage{
    lis;
        username;
        ems;
    constructor(){
        this.username=document.querySelector('.username')
        this.lis=document.querySelectorAll('.loginuser')
        window.addEventListener("load",e=>this.wload(e))
       
    }
    async wload(e){
        var s=localStorage.getItem('user');
        if(s){
           this.lis.forEach((item)=>{
               item.style.display='none'
           })
           this.username.style.display='block'
           this.randers(this.username,s)
           this.ems=document.querySelector('em')
           this.ems.addEventListener('click',e=>this.emsclick(e))
        }
        
    }
    emsclick(e){
        localStorage.clear();
        this.username.style.display='none';
        this.lis.forEach((item)=>{
            item.style.display='block'})
    }
    randers(username,s){
        username.innerHTML=`
           亲爱的 <span> ${s} </span> 你好
           <em>退出</em>
        `
    }
}